﻿using System;
using SocialShare.BusinessEntities;
using System.Linq;

namespace SocialShare.BusinessLogicLayer
{
    internal partial class SocialShare_MembersBLL
    {
        internal bool CheckInputEmptyOrNot(string data)
        {
            if (!String.IsNullOrEmpty(data))
                return true;
            else
                return false;

        }

        internal SocialShare_Members ValidateMember(string userName, string password)
        {
            return (_socialShareDatabaseContext.SocialShare_Members.FirstOrDefault(memObject => memObject.Email == userName && memObject.Password == password));
        }

        internal SocialShare_Members ValidateMember(string userName)
        {
            return (_socialShareDatabaseContext.SocialShare_Members.FirstOrDefault(memObject => memObject.Email == userName));
        }

        internal SocialShare_Members GetMemberByScreenName(string screenName)
        {
            return (_socialShareDatabaseContext.SocialShare_Members.FirstOrDefault(memObject => memObject.ScreenName == screenName));
        }

        internal SocialShare_MemberProfiles GetMemberByBlogName(String blogName, Int32 profileId)
        {
            return (_socialShareDatabaseContext.SocialShare_MemberProfiles.FirstOrDefault(memObject => memObject.BlogName == blogName && memObject.ProfileId != profileId));
        }

        internal SocialShare_Members GetMemberByAuthCode(string authCode)
        {
            return (_socialShareDatabaseContext.SocialShare_Members.FirstOrDefault(memObject => memObject.AuthCode == authCode));
        }
    }

  
}
